<!DOCTYPE html>
<html lang="zh-cn">
<head>
		<meta charset="utf-8">
		<title>导出excel</title>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/amazeui.min.css"/>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/hy.admin.css"/>
</head>
<body>
	<div class="am-g">
		<div class="am-u-md-6 am-cf">
				<div class="am-fl" style="padding:10px;">
		          <div class="am-input-group am-input-group-sm">
		          		<span class="am-input-group-label" style="background-color: #fff;border: 0px;">时间</span>
		          		<input  data-am-datepicker style="width:180px;" type="text" id="start" name="start" class="field am-form-field hy-js-search">
		          </div>
		        </div>
				<div class="am-fl" style="padding:10px;">
		          <div class="am-input-group am-input-group-sm">
		          		<span class="am-input-group-label" style="background-color: #fff;border: 0px;">至&nbsp;&nbsp;&nbsp;</span>
		          		<input  data-am-datepicker style="width:180px;" type="text" id="end" name="end" class="field am-form-field hy-js-search">
		          </div>
		        </div>
				<div  style="padding:10px;">
		          <div class="am-input-group am-input-group-sm">
		          		<span class="am-input-group-label" style="background-color: #fff;border: 0px;">记者名</span>
						<input  style="width:180px;" type="text" id="reporter_name" name="reporter_name" class="field am-form-field hy-js-search">
		          </div>
		        </div>
				<div  style="padding:10px;">
		          <div class="am-input-group am-input-group-sm">
		          		<span class="am-input-group-label" style="background-color: #fff;border: 0px;">类型</span>
						<select name="uvpv" id="uvpv" style="width:180px;"  class=" field am-form-field">
				               <option  value="1">uv</option>
				               <option  value="2">pv</option>
			            </select>
		          </div>
		        </div>
		        <div style="padding:10px;">
		        	<span class="am-input-group-btn" style=" height: 45px;padding-left: 50px;">
		                  <button class="am-btn am-btn-default " onClick="exportExcel();" type="button">导出excel</button>
		                </span>
		        </div>
        </div>
	</div>
	{include file='../Common/hy_footer.html'}
	<script>
		var _start = $("#start"),_end = $("#end"),_reporter_name = $("#reporter_name"),_uvpv = $("#uvpv");
		var isExcel = false;
		function exportExcel(){
			if(isExcel)return;
			var start = _start.val();
			var uvpv = _uvpv.val();
			var end = _end.val();
			var reporter_name = _reporter_name.val();
			if(start==""||end==""){
				alert("请输入导出时间");
				return;
			}
			var startstr = start.replace(/-/g,'/'); // 将-替换成/，因为下面这个构造函数只支持/分隔的日期字符串
			var startdate = new Date(startstr);
			var endstr = end.replace(/-/g,'/'); // 将-替换成/，因为下面这个构造函数只支持/分隔的日期字符串
			var enddate = new Date(endstr);
			if(startdate.getTime()>enddate.getTime())
			{
				alert("开始时间不能小于结束时间");
				return;
			}
			isExcel = true;
			var url = "index.php?g=admin&m=reporter&a=exportAllUVPV";
			window.location.href=url+"&reporter_name="+reporter_name+"&start="+start+"&end="+end+"&uvpv="+uvpv;
			isExcel = false;
			/*$.get(url,data,function(){
				
			}) */
		}
	</script>
</body>
</html>
